package com.wutuo.aggragation.expire.dao;


import com.wutuo.aggragation.expire.domain.ExpireManagementLatest;

import static org.apache.ibatis.jdbc.SqlBuilder.*;

public class ExpireManagementLatestSqlProvider {

    public String insertSelective(ExpireManagementLatest record) {
        BEGIN();
        INSERT_INTO("wt_expire_management_latest");
        
        if (record.getId() != null) {
            VALUES("id", "#{id,jdbcType=BIGINT}");
        }
        
        if (record.getCreateBy() != null) {
            VALUES("create_by", "#{createBy,jdbcType=BIGINT}");
        }
        
        if (record.getCreateDate() != null) {
            VALUES("create_date", "#{createDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            VALUES("update_by", "#{updateBy,jdbcType=BIGINT}");
        }
        
        if (record.getUpdateDate() != null) {
            VALUES("update_date", "#{updateDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRemarks() != null) {
            VALUES("remarks", "#{remarks,jdbcType=VARCHAR}");
        }
        
        if (record.getDelFlag() != null) {
            VALUES("del_flag", "#{delFlag,jdbcType=CHAR}");
        }
        
        if (record.getInstitutionId() != null) {
            VALUES("institution_id", "#{institutionId,jdbcType=BIGINT}");
        }
        
        if (record.getRosterId() != null) {
            VALUES("roster_id", "#{rosterId,jdbcType=BIGINT}");
        }
        
        if (record.getSmsDate() != null) {
            VALUES("sms_date", "#{smsDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getExpireManagementId() != null) {
            VALUES("expire_management_id", "#{expireManagementId,jdbcType=BIGINT}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(ExpireManagementLatest record) {
        BEGIN();
        UPDATE("wt_expire_management_latest");
        
        if (record.getCreateBy() != null) {
            SET("create_by = #{createBy,jdbcType=BIGINT}");
        }
        
        if (record.getCreateDate() != null) {
            SET("create_date = #{createDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            SET("update_by = #{updateBy,jdbcType=BIGINT}");
        }
        
        if (record.getUpdateDate() != null) {
            SET("update_date = #{updateDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRemarks() != null) {
            SET("remarks = #{remarks,jdbcType=VARCHAR}");
        }
        
        if (record.getDelFlag() != null) {
            SET("del_flag = #{delFlag,jdbcType=CHAR}");
        }
        
        if (record.getInstitutionId() != null) {
            SET("institution_id = #{institutionId,jdbcType=BIGINT}");
        }
        
        if (record.getRosterId() != null) {
            SET("roster_id = #{rosterId,jdbcType=BIGINT}");
        }
        
        if (record.getSmsDate() != null) {
            SET("sms_date = #{smsDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getExpireManagementId() != null) {
            SET("expire_management_id = #{expireManagementId,jdbcType=BIGINT}");
        }
        
        WHERE("id = #{id,jdbcType=BIGINT}");
        
        return SQL();
    }
}